<template>
  <ConfigProvider :locale="locale">
    <div id="app">
      <img alt="Vue logo" src="./assets/logo.png" />
      <HelloWorld msg="Welcome to Your Vue.js App" />
      <DatePicker :value="date" @change="setDate" />
    </div>
  </ConfigProvider>
</template>

<script>
import { ConfigProvider, DatePicker } from "ant-design-vue";
import zhCN from "ant-design-vue/es/locale/zh_CN";
import moment from "moment";

import HelloWorld from "@/components/HelloWorld.vue";

export default {
  name: "App",
  components: {
    ConfigProvider,
    HelloWorld,
    DatePicker
  },
  data() {
    return { locale: zhCN };
  },
  computed: {
    date() {
      const { date } = this.$store.state;
      return moment(date, "YYYY-MM-DD");
    }
  },
  methods: {
    setDate(value, dateString) {
      this.$store.commit("setDate", dateString);
    }
  }
};
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
